#include "move.h"

Move::Move(const wxString & title)
    : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(250, 130))
{
    wxPanel * panel = new wxPanel(this, -1);

    st1 = new wxStaticText(panel, wxID_ANY, _T(""), wxPoint(10, 10));
    st2 = new wxStaticText(panel, wxID_ANY, _T(""), wxPoint(10, 30));
    Connect(wxEVT_MOVE, wxMoveEventHandler(Move::OnMove));

    btn = new wxButton(panel, ID_BTN, _T("forlove"), wxPoint(100, 10));
    Connect(ID_BTN, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Move::OnClick));

    Centre();
}

void Move::OnMove(wxMoveEvent & event)
{
    wxPoint size = event.GetPosition();

    st1->SetLabel(wxString::Format(_T("x: %d"), size.x));
    st2->SetLabel(wxString::Format(_T("y: %d"), size.y));
}

void Move::OnClick(wxCommandEvent &evt)
{
	wxLogMessage(_T("This is a test."));
}
